package cn.pkubangbang.demo.democontact.entity;

import java.time.Instant;
import java.util.Objects;

/**
 * @Author: zhangzhenbang@k2data.com.cn
 * @Date: 2018-08-23 14:08
 */
public class Blog {

    private Integer id;
    private Person author;
    private String content;
    private Instant createTime;

    public Blog() {
    }

    public Blog(Integer id, Person author, String content, Instant createTime) {
        this.id = id;
        this.author = author;
        this.content = content;
        this.createTime = createTime;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Person getAuthor() {
        return author;
    }

    public void setAuthor(Person author) {
        this.author = author;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public Instant getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Instant createTime) {
        this.createTime = createTime;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        Blog blog = (Blog) o;
        return Objects.equals(getId(), blog.getId()) &&
            Objects.equals(getAuthor(), blog.getAuthor()) &&
            Objects.equals(getContent(), blog.getContent()) &&
            Objects.equals(getCreateTime(), blog.getCreateTime());
    }

    @Override
    public int hashCode() {

        return Objects.hash(getId(), getAuthor(), getContent(), getCreateTime());
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("Blog{");
        sb.append("id=").append(id);
        sb.append(", author=").append(author);
        sb.append(", content='").append(content).append('\'');
        sb.append(", createTime=").append(createTime);
        sb.append('}');
        return sb.toString();
    }
}
